﻿@{
    ViewBag.Title = "Login";
    Layout = null;
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>管理平台</title>
    <script src="~/Scripts/jquery-1.7.1.js"></script>
    <style type="text/css">
        body
        {
            margin-left: 0px;
            margin-top: 0px;
            margin-right: 0px;
            margin-bottom: 0px;
            overflow: hidden;
        }

        .STYLE3
        {
            color: #528311;
            font-size: 12px;
        }

        .STYLE4
        {
            color: #42870a;
            font-size: 12px;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#btnLogin").click(function () {
                if (validate()) {
                    $("form").submit();
                }
            });
            $(document).keydown(function (event) {

                if (event.keyCode == 13) {
                    if (validate()) {
                        $("form").submit();
                    }
                }

            });

            $("#changeRandom").bind("click", function () {
                this.src = "@Url.Action("RandomCode")" + "?time=" + (new Date()).getTime();
            });

            function validate() {
                console.log("MandomHidden");
                console.log("MandomHidden" + $("#mandomHidden").val());
                if ($("#userName").val() == "") {
                    $("#disMess").html("<font color='red'>用户名不能为空<font>")
                    setTimeout(function () {
                        $("#userName").focus();
                        $("#disMess").html("");
                    }, 2000);
                    return false;
                }
                else if ($("#passWord").val() == "") {
                    $("#disMess").html("<font color='red'>密码不能为空<font>")
                    setTimeout(function () {
                        $("#passWord").focus();
                        $("#disMess").html("");
                    }, 2000);
                    return false;
                }
                else if ($("#randomCode").val() == "") {
                    $("#disMess").html("<font color='red'>验证码不能为空<font>")
                    setTimeout(function () {
                        $("#randomCode").focus();
                        $("#disMess").html("");
                    }, 2000);
                    return false;
                }
                else if ($("#randomCode").val().length != 5) {
                    $("#disMess").html("<font color='red'>验证码长度为5位<font>")
                    setTimeout(function () {
                        $("#randomCode").focus();
                        $("#disMess").html("");
                    }, 2000);
                    return false;
                }
                else {
                    return true;
                }
            }
        });
    </script>
</head>

<body>
    <form action="/Home/LoginData" method="post">
        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td bgcolor="#e5f6cf">&nbsp;</td>
            </tr>
            <tr>
                <td height="608" background="images/login_03.gif">
                    <table width="862" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td height="266" background="images/login_04.gif">&nbsp;</td>
                        </tr>
                        <tr>
                            <td height="95">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="424" height="95" background="images/login_06.gif">&nbsp;</td>
                                        <td width="183" background="images/login_07.gif">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td width="21%" height="30">
                                                        <div align="center"><span class="STYLE3">用户</span></div>
                                                    </td>
                                                    <td width="79%" height="30">
                                                        <input type="text" id="userName" name="userName" style="height: 18px; width: 130px; border: solid 1px #cadcb2; font-size: 12px; color: #81b432;" /></td>
                                                </tr>
                                                <tr>
                                                    <td height="30">
                                                        <div align="center"><span class="STYLE3">密码</span></div>
                                                    </td>
                                                    <td height="30">
                                                        <input type="password" id="passWord" name="passWord" style="height: 18px; width: 130px; border: solid 1px #cadcb2; font-size: 12px; color: #81b432;" /></td>
                                                </tr>
                                                <tr>
                                                    <td height="30">
                                                        <div align="center"><span class="STYLE3">验证码</span></div>
                                                    </td>
                                                    <td height="30">
                                                        <input type="text" id="randomCode" name="randomCode" style="height: 18px; width: 60px; border: solid 1px #cadcb2; font-size: 12px; color: #81b432;" />

                                                        <img src="/Home/RandomCode" id="changeRandom" alt="验证码" style="width: 60px; height: 20px" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td height="30">&nbsp;</td>
                                                    <td height="30">
                                                        <input type="button" value="登录" id="btnLogin" />
                                                        <input type="reset" value="重置" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td height="30">&nbsp;</td>
                                                    <td height="30">
                                                        <span id="disMess">@Html.Raw(ViewBag.ErrorMessage)</span>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                        <td width="255" background="images/login_08.gif">&nbsp;</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td height="247" valign="top" background="images/login_09.gif">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="22%" height="30">&nbsp;</td>
                                        <td width="56%">&nbsp;</td>
                                        <td width="22%">&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td height="30">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td width="44%" height="20">&nbsp;</td>
                                                    <td width="56%" class="STYLE4">版本 2013V1.0 </td>
                                                </tr>
                                            </table>
                                        </td>
                                        <td>&nbsp;</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td bgcolor="#a2d962">&nbsp;</td>
            </tr>
        </table>
    </form>
</body>
</html>
